package com.nicky.kids;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import com.nicky.kids.Test.TestMainActivity;
import com.nicky.kids.Utility.IntentUtil;
import com.nicky.kids.Utility.TLog;

public class PublishActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_publish);

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        //getMenuInflater().inflate(R.menu.home, menu);

        menu.add("publish").setIcon(android.R.drawable.ic_menu_send).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

        return true;
    }

    @Override
    public boolean onPrepareOptionsMenu(Menu menu) {
        // If the nav drawer is open, hide action items related to the content view
//        boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList);
//        menu.findItem(R.id.action_websearch).setVisible(!drawerOpen);
        return super.onPrepareOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {

        switch (item.getItemId()) {
//            case android.R.id.home:
//                // 当Action Bar的图标被单击时执行下面的Intent
//                Intent intent = new Intent(this, Android123.class);
//                startActivity(intent);
//                break;
        }

        TLog.e("nick", "menu selected: " + item.getTitle());

        String selectedItem = item.getTitle().toString();
        if (selectedItem.equals("publish")) {
            Intent intent = new Intent(PublishActivity.this, TestMainActivity.class);
            IntentUtil.startIntent(PublishActivity.this, intent);
            this.finish();
        }


        return super.onOptionsItemSelected(item);
    }
}
